package com.ahu.qifei.fund.service.impl;

import com.ahu.qifei.fund.bean.FundHtml;
import com.ahu.qifei.fund.common.util.MailTemplate;
import com.ahu.qifei.fund.service.IMailHTMLTemplateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 *
 * @author ShiQifei
 * @date 2020/11/21 11:25
 */

@Service
@Slf4j
public class MailHTMLTemplateServiceImpl  implements IMailHTMLTemplateService {


    @Override
    public String html(List<FundHtml> fundHtmlList) {
        MailTemplate mailTemplate = new MailTemplate();

        for(FundHtml fundHtml : fundHtmlList) {
            mailTemplate.code(fundHtml.getCode(), fundHtml.getName());
            for(Map<String, String> map: fundHtml.getData()) {
                mailTemplate.value(map.get("value"), map.get("days"));
            }
            mailTemplate.addTr();
        }
        return mailTemplate.toString();
    }
}
